<template>
  <div>
    <span v-if="str.type == 'text'">
      {{ str.value }}
    </span>
    <img
      v-else-if="str.type == 'img'"
      alt=""
      :src="str.value"
      style="height: 34px"
    />
    <div v-else class="iconfont columnicon" :class="str.value"></div>
  </div>
</template>

<script>
  export default {
    name: 'Tablecolumn',
    props: {
      scope: {
        type: Object,
        default: () => {
          return {}
        },
      },
    },
    data() {
      return {}
    },
    computed: {
      str() {
        let r = this.$z.tablestr(this.scope.item, this.scope.row)
        if (typeof r == 'object') {
          return r
        } else if (this.scope.item.type == 'img') {
          r = { value: r, type: 'img' }
        } else {
          r = { value: r, type: 'text' }
        }
        return r
      },
    },
    created() {},
    mounted() {},
    methods: {},
  }
</script>
<style lang="scss" scope>
  @import '@/styles/base.scss';
  .columnicon {
    color: $uni-color-primary;
    text-align: center;
  }
</style>
